package c5.Example6;

public class Example6 {
    public static void main(String[] args) {
        String str = "石家庄-武汉-哈尔滨";
        System.out.println("从第5个字符截取尾部的结果:"+str.substring(4));
        System.out.println("从第5个字符截取第六个的结果:"+str.substring(4,6));
        System.out.println("分割后的字符串数组中的元素依次为：");
        String[] strArray = str.split("_");
        for (int i = 0; i < strArray.length;i++) {
            if (i != strArray.length - 1) {
                System.out.println(strArray[i] + ",");
            } else {
                System.out.println(strArray[i]);
            }
        }
    }
}
